package com.wang.project.pay;

import com.wang.project.model.modle.PayModel;
import com.wang.project.pay.zfb.AlipayFaceToFaceService;
import com.wang.project.pay.zfb.ZFBPreorderActionVO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class PayStrategyByZFB extends PayStrategy {

    @Resource
    private AlipayFaceToFaceService alipayFaceToFaceService;

    /**
     * 支付宝支付逻辑
     */
    @Override
    PayStrategyModel algorithmInterface(HttpServletRequest request, HttpServletResponse response, PayModel freshKeyPayModel) {
        ZFBPreorderActionVO zfbPreorderActionVO = alipayFaceToFaceService.ZFBPreorderAction(request, response, freshKeyPayModel);
        PayStrategyModel payModel = new PayStrategyModel();
        BeanUtils.copyProperties(zfbPreorderActionVO, payModel);
        return payModel;
    }
}
